import request from '@/router/axios';
import {baseUrl} from "../../config/env";

export const menuPage = (current, size, params) => {
  return request({
    // url: baseUrl + '/api-user/menus/menuPage',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const menuTree = (params) => {
  return request({
    url: baseUrl + '/api-user/menus/menuTree',
    method: 'get',
    params: params
  })
}

export const remove = (ids) => {
  return request({
    url: baseUrl + '/api-user/menus/remove/'+ids,
    method: 'post',
    // params: {
    //   ids,
    // }
  })
}

export const create = (row) => {
  return request({
    url: baseUrl + '/api-user/menus/create',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl + '/api-user/menus/update',
    method: 'post',
    data: row
  })
}

export const getMenu = (id) => {
  return request({
    url: baseUrl + '/api-user/menus/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

export const getLazyMenuList = (parentId, params) => {
  return request({
    url: '/api/blade-system/menu/lazy-menu-list',
    method: 'get',
    params: {
      ...params,
      parentId
    }
  })
}
